﻿using System.ComponentModel.DataAnnotations;
using System.Xml.Linq;

namespace MvcCart.Models
{
    public class Cart
    {

        public int Id { get; set; } //购物车id
        [Required(ErrorMessage = "商品名称必填")]
        [StringLength(20, MinimumLength = 1, ErrorMessage = "3-20个字符")]
        [Display(Name = "商品名称")]
        public string? Productid { get; set; } // 商品id
        [Required(ErrorMessage = "商品数量必填")]
        [Range(1, 100, ErrorMessage = "1-100之间")]
        [Display(Name = "商品数量")]
        public int Productnum { get; set; } //商品数量
        [Required(ErrorMessage = "商品价格必填")]
        [Range(1, 100, ErrorMessage = "1-100之间")]
        [Display(Name = "商品价格")]
        [DataType(DataType.Currency)]
        public decimal Price { get; set; } // 商品价格
        [Required(ErrorMessage = "用户名称必填")]
        [Display(Name = "用户名称")]
        public string? Userid { get; set; } // 用户id
        [Display(Name = "创建时间")]
        [DataType(DataType.Date)]
        public DateTime Createtime { get; set; } // 创建时间

    }
}
